<%@ page pageEncoding="UTF-8"%>
<%@ include file="/common/token.jsp"%>
<%@ include file="/common/user.jsp"%>
<%
	Integer patientUid = input.getInt("patient_uid", 1717);
	List<Map> userInfo = QBuilder.db("basedb").select("new map(uid as patient_uid, name as name, phone as phone, gender as gender,cardNumber as card_number,medicalType as medical_type, medicalNumber as medical_number, age as age)").from("UserProfile").where(new Where("hospital=", hospital).and("status=", STATUS_ENABLE).and("uid=", patientUid).and("self=", SELF)).query().getResultObj();
	if (isEmpty(userInfo)) {
		 Tools.encryptPrint(out, new Message(30041, "没有您要查询的这个患者信息"));
		 return;
	}
	Map res = userInfo.get(0);
	User user = userByUid(patientUid);
	res.put("avatar", isEmpty(user)?null:user.getAvatar());
	List<Map> plist = QBuilder.db("basedb").select().from("patient_info").where(new Where("hospital=", hospital).and("status=", STATUS_ENABLE).and("patient_uid=", patientUid)).query().getResultObj();
	if (!isEmpty(plist)) {
		Map pMap = plist.get(0);
		pMap.remove("$type$");
		pMap.remove("status");
		pMap.remove("mod_user");
		pMap.remove("create_time");
		pMap.remove("create_user");
		pMap.remove("mod_time");
		res.putAll(pMap);
	}
	msg.put("data", res);
    Tools.encryptPrint(out, msg);
%>
